using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MultiPackage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = ConfigurationManager.AppSettings["PageTitle"] + " - Multiple Package Editor";
        Hidden_SessionID.Value = Convert.ToString(Session["SessionID"]);
        Hidden_UserID.Value = Convert.ToString(Session["UserID"]);

        // Set up user hidden user access list box for access from client side
        ListBox_UserAccess.Style.Add("display", "none");
        DataTable UserAccessDT = (DataTable)Session["UserAccess"];
        ListBox_UserAccess.DataSource = UserAccessDT;
        ListBox_UserAccess.DataTextField = UserAccessDT.Columns[0].ColumnName;
        ListBox_UserAccess.DataValueField = UserAccessDT.Columns[0].ColumnName;
        ListBox_UserAccess.DataBind();

        if (!Page.IsPostBack)
        {
            if (PreviousPage != null)
            {
                if (PreviousPage.Title.Contains("Package List"))
                {
                    string ListLookupIDs = "";
                    ListBox SelectedPackages = (ListBox)PreviousPage.Form.FindControl("ListBox_Selected");
                    if (SelectedPackages != null)
                    {
                        foreach (ListItem Item in SelectedPackages.Items)
                        {
                            ListLookupIDs += Item.Value + "_";
                        }
                    }
                    Hidden_EditorPageID.Value = "multiPackage";
                    Hidden_ListLookupIDs.Value = ListLookupIDs.Remove(ListLookupIDs.Length - 1);
                    Hidden_ListLookupCount.Value = Convert.ToString(SelectedPackages.Items.Count);
                }
            }
        }
    }
}
